package com.liaojp.sccp.common;

import java.util.Map;

public class Result {
    private int code; // 状态码； 0结尾表示成功，非0结尾表示失败

    private String msg; // 提示信息

    private Map<String, Object> data;

    public static Result success(Map<String, Object> data){
        Result result = new Result();
        result.setCode(0);
        result.setData(data);

        return result;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }

    public Result fail(String msg) {
        Result result = new Result();
        result.setCode(1);
        result.setMsg(msg);
        return result;
    }
}
